package com.atguigu.yygh.hosp.controller.admin;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.vo.hosp.ScheduleQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/*==========================================
      时 间:   2022-03-09
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;


    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public R getSchedulePageByCondition(@PathVariable Integer page,
                             @PathVariable Integer limit,
                             @PathVariable String hoscode,
                             @PathVariable String depcode){
       Map<String,Object> resultMap=  scheduleService.getSchedulePageByCondition(page,limit,hoscode,depcode);

       return R.ok().data(resultMap);
    }


    //
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public R getScheduleDetail(@PathVariable String hoscode,
                               @PathVariable String depcode,
                               @PathVariable String workDate){
        List<Schedule> list=scheduleService.getScheduleDetail(hoscode,depcode,workDate);

        return R.ok().data("list",list);
    }
}
